﻿using Microsoft.EntityFrameworkCore;

namespace Lingmeng.EntityFrameworkCore
{
    public class MasterDbContext<TDbContext>:DbContext where TDbContext:DbContext
    {
        protected MasterDbContext(DbContextOptions<TDbContext> options):base(options)
        {
            
        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //禁用跟踪查询
            optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrackingWithIdentityResolution);
            //显示更详细的日志
            optionsBuilder.EnableDetailedErrors();
        }
    }
}